package com.lebang.feign.bus;

import com.lebang.feign.bus.fallback.BusFallback;
import com.lebang.model.RequestUserInfo;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author xwj
 */
@FeignClient(name = "wangzhuan-bus", contextId = "wangzhuan-bus-info", fallback = BusFallback.class)
public interface BusFeign {

    /**
     * 城市列表--app
     *
     * @return 返回结果
     */
    @ApiOperation("城市列表")
    @GetMapping("/api/bus/city")
    JsonData city();

    /**
     * 搜索公交线路
     *
     * @return 返回结果
     */
    @ApiOperation("搜索公交线路")
    @PostMapping("/api/bus/routes")
    JsonData routes(@RequestBody RequestUserInfo requestUserInfo,
                    @RequestParam(name = "cityId") String cityId,
                    @RequestParam(name = "keywords") String keywords,
                    @RequestParam(name = "code") String code);

    /**
     * 公交实时信息
     *
     * @return 返回结果
     */
    @ApiOperation("公交实时信息")
    @PostMapping("/api/bus/info")
    JsonData info(@RequestBody RequestUserInfo requestUserInfo,
                  @RequestParam(name = "cityId") String cityId,
                  @RequestParam(name = "rouseId") String rouseId,
                  @RequestParam(name = "routeNum") String routeNum,
                  @RequestParam(name = "routeName") String routeName);


    /**
     * 热门城市列表
     * @return
     */
    @ApiOperation("热门城市列表")
    @GetMapping("/api/bus/hot")
    JsonData hot();

    /**
     * 公交基础信息
     *
     * @return 返回结果
     */
    @ApiOperation("公交基础信息")
    @PostMapping("/api/bus/base")
    JsonData base(@RequestBody RequestUserInfo requestUserInfo,
                  @RequestParam(name = "cityId") String cityId,
                  @RequestParam(name = "rouseId") String rouseId,
                  @RequestParam(name = "routeNum") String routeNum,
                  @RequestParam(name = "routeName") String routeName);


    /**
     * 公交实时
     *
     * @return 返回结果
     */
    @ApiOperation("公交实时")
    @PostMapping("/api/bus/buses")
    JsonData buses(@RequestBody RequestUserInfo requestUserInfo,
                   @RequestParam(name = "cityId") String cityId,
                   @RequestParam(name = "rouseId") String rouseId,
                   @RequestParam(name = "routeNum") String routeNum,
                   @RequestParam(name = "routeName") String routeName);
}
